import fetch from '../config/fetch'


var login = (email, password) => fetch('POST', '/login', {email, password});

var hasEmail = (email) => fetch('GET', '/email', {email});

var getCode = (email) => fetch('GET', '/code', {email});

var register = (email, password, nick, code) => fetch('POST', '/register', {email, password, nick, code});

var getUserInfo = (email, token) => fetch('GET', '/v1/user_info', {email, token});

var createRoom = (email,
                  token,
                  name,
                  cover,
                  creatorId,
                  creatorEmail,
                  creatorNick,
                  signature,
                  type,
                  peoples) => fetch('POST', '/v1/room', {email, token, name, cover, creatorId, creatorEmail, creatorNick, signature, type, peoples});

var roomList = (userId,
                type,  //type start length 都为-99时表示请求用户关注的所有空间列表
                start, length) => fetch('GET', '/v1/room', )


export { login, hasEmail, getCode, register, getUserInfo, createRoom}
